package base.thread_JUC2.chapter01.demo011;

public class Task implements Runnable{

    @Override
    public void run() {
        while (true) {
            int result = 0;
            result = 100/(int)(Math.random()*10);
            System.out.println(Thread.currentThread().getId()+"号线程执行结果: "+ result);
            if (Thread.currentThread().isInterrupted()) {
                System.out.println(Thread.currentThread().getId()+" 被中断:"+Thread.currentThread().getState()+"------"+Thread.currentThread().isInterrupted());
                return;// 结束线程任务方法：run（）
            }
        }
    }
}
